import pytest

from storage.blobstore.compression import (
    compress_blob_zstd,
    compress_blob_lz4,
    decompress_blob_zstd,
)


@pytest.mark.parametrize('compress', [
    pytest.param(compress_blob_lz4, id='lz4'),
    pytest.param(compress_blob_zstd, id='zstd'),
])
def test_smoking_compress(compress, compress_data):
    compressed = compress_blob_zstd(compress_data)
    decompressed = decompress_blob_zstd(compressed)
    assert decompressed == compress_data


@pytest.mark.benchmark
@pytest.mark.parametrize('compress', [
    pytest.param(compress_blob_lz4, id='lz4'),
    pytest.param(compress_blob_zstd, id='zstd'),
])
def test_benchmark_compression(benchmark, compress, compress_data):
    benchmark(compress, compress_data)
